﻿namespace Jumpton.SFA.Server.Entity
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;


    [System.SerializableAttribute()]
    [RelationMap("Customer", typeof(CUSTOMERS), "a")]
    [Relation(RelationJoinType.Inner, typeof(CONTACT_INFO), "b", "a", "customer_id", "ID")]
    public class CustomerView : ObjectRow
    {

        public CustomerView()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public CustomerView(System.Data.DataRow dataRow, ObjectTable parent) :
            base(dataRow, parent)
        {
        }

        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected CustomerView(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
            base(info, context)
        {
        }

        [Key("ID", TableAlias = "a")]
        public decimal ID
        {
            get
            {
                return (System.Decimal)GetValue("ID");
            }
            set
            {
                SetValue("ID", value);
            }
        }

        [Field("CODE", TableAlias = "a")]
        public string CODE
        {
            get
            {
                return (System.String)GetValue("CODE");
            }
            set
            {
                SetValue("CODE", value);
            }
        }

        [Field("NAME", TableAlias = "a")]
        public string NAME
        {
            get
            {
                return (System.String)GetValue("NAME");
            }
            set
            {
                SetValue("NAME", value);
            }
        }

        [Field("NAME2", TableAlias = "a")]
        public string NAME2
        {
            get
            {
                return (System.String)GetValue("NAME2");
            }
            set
            {
                SetValue("NAME2", value);
            }
        }

        [Field("CHAIN_CODE", TableAlias = "a")]
        public string CHAINCODE
        {
            get
            {
                return (System.String)GetValue("CHAINCODE");
            }
            set
            {
                SetValue("CHAINCODE", value);
            }
        }

        [Field("BANNER_CODE", TableAlias = "a")]
        public string BANNERCODE
        {
            get
            {
                return (System.String)GetValue("BANNERCODE");
            }
            set
            {
                SetValue("BANNERCODE", value);
            }
        }

        [Field("IDENTITY1", TableAlias = "a")]
        public float IDENTITY1
        {
            get
            {
                return null == GetValue("IDENTITY1") ? 0 : (float)GetValue("IDENTITY1");
            }
            set
            {
                SetValue("IDENTITY1", value);
            }
        }

        [Field("IDENTITY2", TableAlias = "a")]
        public float IDENTITY2
        {
            get
            {
                return null == GetValue("IDENTITY2") ? 0 : (float)GetValue("IDENTITY2");
            }
            set
            {
                SetValue("IDENTITY2", value);
            }
        }

        [Field("PARENT_CODE", TableAlias = "a")]
        public string PARENTCODE
        {
            get
            {
                return (System.String)GetValue("PARENTCODE");
            }
            set
            {
                SetValue("PARENTCODE", value);
            }
        }

        [Field("VALID", TableAlias = "a")]
        public string VALID
        {
            get
            {
                return (System.String)GetValue("VALID");
            }
            set
            {
                SetValue("VALID", value);
            }
        }

        [Field("STATUS", TableAlias = "a")]
        public string STATUS
        {
            get
            {
                return (System.String)GetValue("STATUS");
            }
            set
            {
                SetValue("STATUS", value);
            }
        }

        [Field("CUST_CLASS_CODE", TableAlias = "a")]
        public string CUSTCLASSCODE
        {
            get
            {
                return (System.String)GetValue("CUSTCLASSCODE");
            }
            set
            {
                SetValue("CUSTCLASSCODE", value);
            }
        }

        [Field("GEO_LEVEL_CODE", TableAlias = "a")]
        public string GEOLEVELCODE
        {
            get
            {
                return (System.String)GetValue("GEOLEVELCODE");
            }
            set
            {
                SetValue("GEOLEVELCODE", value);
            }
        }

        [Field("LOCAL_LEVEL1_CODE", TableAlias = "a")]
        public string LOCALLEVEL1CODE
        {
            get
            {
                return (System.String)GetValue("LOCALLEVEL1CODE");
            }
            set
            {
                SetValue("LOCALLEVEL1CODE", value);
            }
        }

        [Field("LOCAL_LEVEL2_CODE", TableAlias = "a")]
        public string LOCALLEVEL2CODE
        {
            get
            {
                return (System.String)GetValue("LOCALLEVEL2CODE");
            }
            set
            {
                SetValue("LOCALLEVEL2CODE", value);
            }
        }

        [Field("CONTACT_TIME_ID", TableAlias = "a")]
        public decimal CONTACTTIMEID
        {
            get
            {
                return (System.Decimal)GetValue("CONTACTTIMEID");
            }
            set
            {
                SetValue("CONTACTTIMEID", value);
            }
        }

        [Field("DEFAULT_UOM_CODE")]
        public string DEFAULTUOMCODE
        {
            get
            {
                return (System.String)GetValue("DEFAULTUOMCODE");
            }
            set
            {
                SetValue("DEFAULTUOMCODE", value);
            }
        }

        [Field("DOC_FOOTER")]
        public string DOCFOOTER
        {
            get
            {
                return (System.String)GetValue("DOCFOOTER");
            }
            set
            {
                SetValue("DOCFOOTER", value);
            }
        }

        [Field("ADDITIONAL_INFO")]
        public string ADDITIONALINFO
        {
            get
            {
                return (System.String)GetValue("ADDITIONALINFO");
            }
            set
            {
                SetValue("ADDITIONALINFO", value);
            }
        }

        [Field("CUSTOMER_PRODUCT_LIST_ID")]
        public decimal CUSTOMERPRODUCTLISTID
        {
            get
            {
                return null == GetValue("CUSTOMERPRODUCTLISTID") ? -1 : (System.Decimal)GetValue("CUSTOMERPRODUCTLISTID");
            }
            set
            {
                SetValue("CUSTOMERPRODUCTLISTID", value);
            }
        }

        [Field("DESTINY_DISTRIBUTION_AREA")]
        public string DESTINYDISTRIBUTIONAREA
        {
            get
            {
                return (System.String)GetValue("DESTINYDISTRIBUTIONAREA");
            }
            set
            {
                SetValue("DESTINYDISTRIBUTIONAREA", value);
            }
        }

        [Field("MEASURE_PROFILE_ID")]
        public decimal MEASUREPROFILEID
        {
            get
            {
                return null == GetValue("MEASUREPROFILEID") ? -1 : (System.Decimal)GetValue("MEASUREPROFILEID");
            }
            set
            {
                SetValue("MEASUREPROFILEID", value);
            }
        }

        [Field("DOMAIN_ID")]
        public decimal DOMAINID
        {
            get
            {
                return (System.Decimal)GetValue("DOMAINID");
            }
            set
            {
                SetValue("DOMAINID", value);
            }
        }

       

        [Field("BLACKLISTED")]
        public string BLACKLISTED
        {
            get
            {
                return (System.String)GetValue("BLACKLISTED");
            }
            set
            {
                SetValue("BLACKLISTED", value);
            }
        }

        [Field("SHIPFROMLOCATIONCODE")]
        public string SHIPFROMLOCATIONCODE
        {
            get
            {
                return (System.String)GetValue("SHIPFROMLOCATIONCODE");
            }
            set
            {
                SetValue("SHIPFROMLOCATIONCODE", value);
            }
        }

        [Field("BRACKET_ID")]
        public decimal BRACKETID
        {
            get
            {
                return (System.Decimal)GetValue("BRACKETID");
            }
            set
            {
                SetValue("BRACKETID", value);
            }
        }

        [Field("ICO_PROFILE_ID")]
        public decimal ICOPROFILEID
        {
            get
            {
                return (System.Decimal)GetValue("ICOPROFILEID");
            }
            set
            {
                SetValue("ICOPROFILEID", value);
            }
        }

        [Field("INITIATIVE_PROFILE_ID")]
        public decimal INITIATIVEPROFILEID
        {
            get
            {
                return (System.Decimal)GetValue("INITIATIVEPROFILEID");
            }
            set
            {
                SetValue("INITIATIVEPROFILEID", value);
            }
        }

        [Field("DEFAULT_SHIP_TO_CODE")]
        public string DEFAULTSHIPTOCODE
        {
            get
            {
                return (System.String)GetValue("DEFAULTSHIPTOCODE");
            }
            set
            {
                SetValue("DEFAULTSHIPTOCODE", value);
            }
        }

        [Field("ORG_ID")]
        public int ORGID
        {
            get
            {
                return (System.Int32)GetValue("ORGID");
            }
            set
            {
                SetValue("ORGID", value);
            }
        }

        //[Field("Region_ID")]
        //public int RegionId
        //{
        //    get
        //    {
        //        if (GetValue("RegionId") == null)
        //            return 0;
        //        return (System.Int32)GetValue("RegionId");
        //    }
        //    set
        //    {
        //        SetValue("RegionId", value);
        //    }
        //}

        
        [Field("ADDRESS_LINE")]
        public System.String ADDRESS_LINE
        {
            get
            {
                return (System.String)GetValue("ADDRESS_LINE");
            }
            set
            {
                SetValue("ADDRESS_LINE", value);
            }
        }

        [Field("TELEPHONE")]
        public System.String TELEPHONE
        {
            get
            {
                return (System.String)GetValue("TELEPHONE");
            }
            set
            {
                SetValue("TELEPHONE", value);
            }
        }

        [Field("FAX")]
        public System.String FAX
        {
            get
            {
                return (System.String)GetValue("FAX");
            }
            set
            {
                SetValue("FAX", value);
            }
        }

        [Field("E_MAIL")]
        public System.String EMAIL
        {
            get
            {
                return (System.String)GetValue("EMAIL");
            }
            set
            {
                SetValue("EMAIL", value);
            }
        }

        [Field("SLOG_CODE")]
        public System.String SLOGCODE
        {
            get
            {
                return (System.String)GetValue("SLOGCODE");
            }
            set
            {
                SetValue("SLOGCODE", value);
            }
        }
    }
}
